
package com.tenglong.teacher.ui.common.activity;


import android.support.annotation.LayoutRes;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.cuotibao.zhuoxiao.basics.BaseCommonActivity;
import com.tenglong.teacher.R;
import com.tenglong.teacher.ui.answerq.P2PRecord;


public class BaseActivity extends BaseCommonActivity {
    protected TextView mTitleView;
    protected ImageButton mBack;
    protected Button mRight;
    public P2PRecord p2PRecord;

    public void setContentView(@LayoutRes int layoutResID) {
        LinearLayout layout = (LinearLayout) View.inflate(this, R.layout.actionbar_applayout, null);
        if (layoutResID != 0) {
            layout.addView(View.inflate(this, layoutResID, null));
        }
        setContentView(layout);
        // getActionBar().setCustomView(layout.findViewById(R.id.actionbar_container));
        mBack = findViewById(R.id.action_button1);
        mBack.setOnClickListener(this);
        mTitleView = layout.findViewById(R.id.action_text);
        mRight = layout.findViewById(R.id.right_btn);
        p2PRecord = new P2PRecord();
    }

    @Override
    public void setTitle(String title) {
        mTitleView.setText(TextUtils.isEmpty(title) ? "" : title);
    }

    @Override
    public void setTitle(int title) {
        mTitleView.setText(title);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.action_button1) {
            onBackPressed();
        }
    }
}
